<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>结构伪类</title>
    <style type="text/css">
        .wrapper {
            width: 80%;
            border: 1px solid blue;
            margin: 25px auto;
        }
        
        .first div:empty {
            height: 50px;
            background: #dedede;
        }
        
        .first div:not(:empty) {
            height: 50px;
            background: #9669ff;
        }
        
        .second :empty {
            display: block;
            height: 50px;
            border: 1px solid red;
        }
    </style>
</head>

<body>

    <div class="wrapper first">
        <div>
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div></div>
        <div>hello</div>
    </div>

    <div class="wrapper second">
        <div>
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div></div>
        <div>hello</div>
    </div>

</body>

</html>